package com.aisoback.controller;

import com.aisoback.model.Picture;
import com.aisoback.model.vo.QueryPictureVO;
import com.aisoback.service.PictureService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;


@RestController
@RequestMapping("/picture")
//@CrossOrigin(origins = "*")
public class PictureController {
    @Resource
    private PictureService pictureService;

    @PostMapping("/getPicture/page")
    public Page<Picture> getPictureList(@RequestBody QueryPictureVO queryPictureVO) throws IOException {
        String searchText = queryPictureVO.getSearchText();
        Integer pageNum = queryPictureVO.getPageNum();
        Integer pageSize = queryPictureVO.getPageSize();
        Page<Picture> pictureList = pictureService.getPictureList(searchText, pageNum, pageSize);
        return pictureList;
    }
}
